<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="Traders.aspx.cs"
    Inherits="Traders" Title="The Forecast Exchange - All traders" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h1>
        All forecast traders</h1>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        Width="100%" CellPadding="2" AllowSorting="True"
        ForeColor="#333333" GridLines="Vertical" OnSorting="GridView1_Sorting">
        <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
        <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
        <Columns>
            <asp:TemplateField HeaderText="Name" SortExpression="[UserName]">
                <ItemTemplate>
                    <img alt="Player" src="images/silk/user.png"> <a href="Portfolio.aspx?traderid=<%# Eval("PlayerId") %>"><%# Eval("UserName") %></a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderStyle-Width="100px" HeaderText="<span title='How active the trader has been'>Activity level</span>" ItemStyle-HorizontalAlign="Right" DataField="ActivityLevel" SortExpression="[ActivityLevel]" DataFormatString="{0:#,0}" HtmlEncode="false"/>
            <asp:TemplateField HeaderText="<span title='When the trader last accepted an offer'>Last trade</span>" SortExpression="LastActivity">
                <ItemStyle HorizontalAlign="Center" />
                    <ItemTemplate>
                        <%# GetLastActivityTime((DateTime)Eval("LastActivity")) %>
                    </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderStyle-Width="100px" HeaderText="<span title='Which prediction the trader owns the most stocks in'>Favourite</span>" ItemStyle-HorizontalAlign="Left" DataField="FavouriteStock" SortExpression="[FavouriteStock]" HtmlEncode="false"/>
            <asp:BoundField HeaderStyle-Width="100px" HeaderText="<span title='How much cash the trader currently has to spend'>Available balance</span>" ItemStyle-HorizontalAlign="Right" DataField="AvailableBalance" SortExpression="[AvailableBalance]" DataFormatString="{0:#,0}" HtmlEncode="false"/>
            <asp:BoundField HeaderStyle-Width="100px" HeaderText="<span title='How much cash the trader currently has to spend plus what is set aside for offers to buy stocks'>Actual balance</span>" ItemStyle-HorizontalAlign="Right" DataField="ActualBalance" SortExpression="[ActualBalance]" DataFormatString="{0:#,0}" HtmlEncode="false"/>
            <asp:BoundField HeaderStyle-Width="100px" HeaderText="<span title='How much the stocks are estimated to be worth'>Stock value</span>" ItemStyle-HorizontalAlign="Right" DataField="StockValue" SortExpression="[StockValue]" DataFormatString="{0:#,0}" HtmlEncode="false"/>
            <asp:BoundField HeaderStyle-Width="100px" HeaderText="<span title='Actual balance plus Stock value'>Total value</span>" ItemStyle-HorizontalAlign="Right"  DataField="TotalValue" SortExpression="[TotalValue]" DataFormatString="{0:#,0}" HtmlEncode="false"/>
            <asp:TemplateField HeaderText="Medals" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                     <%# GetMedals((int)Eval("PlayerId")) %>
                    &nbsp;
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
        <AlternatingRowStyle BackColor="#F7F7F7" />
    </asp:GridView>
</asp:Content>
